import com.wang.dao.UserMapper;
import com.wang.pojo.User;
import com.wang.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class Mytest {
    @Test
    public void test(){
        //第一步：获取SqlSeession对象
        SqlSession sqlSession= MybatisUtils.getSqlSession();
        //执行sql  方式一：getMapper
        UserMapper userMapper=sqlSession.getMapper(UserMapper.class);

        List<User> userList=userMapper.getUserList();

        for (User user:userList){
            System.out.println(user);
        }
        //关闭SqlSession
        sqlSession.close();
    }
}
